<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="DatabaseDetail.aspx.cs" Inherits="DatabaseDetail" Title="" %>
<%@ Register Assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table id="tblMain" cellpadding="0" cellspacing="1" width="100%">
    <tr><td bgcolor="#EBE7E7" colspan="2" style="width: 100%"><table style="width: 100%"><tr><td>Database Detail</td><td style="text-align: right;"><asp:LinkButton ID="btnUpdate" runat="server" ForeColor="Green" onclick="btnUpdate_Click">Update</asp:LinkButton>&nbsp;<asp:LinkButton ID="btnDelete" runat="server" OnClick="btnDelete_Click" ForeColor="Red">Delete</asp:LinkButton>&nbsp;</td></td></tr></table></td></tr>
</table>
<table id="TableDetail" cellpadding="5" cellspacing="1"width="100%" >
    <tr>
        <td bgcolor="#EBE7E7" style="width: 150px">Instance Name:</td>
        <td><table cellpadding="0" cellspacing="1" class="style1">
                <tr>
                    <td><asp:Label ID="lblInstanceName" runat="server" Font-Bold="True"></asp:Label></td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td bgcolor="#EBE7E7" style="width: 150px">
            Database Name:</td>
        <td>
            <table cellpadding="0" cellspacing="1" width=100%>
                <tr>
                    <td style="text-align: left"><asp:Label ID="lblDatabaseName" runat="server" Font-Bold="True"></asp:Label></td>
                    <td style="text-align: right"><asp:CheckBox ID="chkIsAudited" runat="server" AutoPostBack="True" Text="Is Audited" TextAlign="Left" />&nbsp;&nbsp;<asp:CheckBox ID="chkIsSensitive" runat="server" AutoPostBack="True" Text="Is Sensitive" TextAlign="Left" />
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td bgcolor="#EBE7E7" style="width: 150px">Primary Contact EMail</td>
        <td> <asp:TextBox ID="txtPrimaryContactEMail" runat="server" Width="475px"></asp:TextBox>            
            &nbsp;<asp:HyperLink ID="lnkSendEMail" runat="server">Send Mail</asp:HyperLink></td>
    </tr>
    <tr>
        <td bgcolor="#EBE7E7" style="width: 150px">Database Size (MB):</td>
        <td><asp:Label ID="lblTotalSizeMB" runat="server"></asp:Label>MB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <asp:Label ID="lblDataSizeMB" runat="server"></asp:Label>MB&nbsp;(DATA)&nbsp;&nbsp; <asp:Label ID="lblLogSizeMB" runat="server"></asp:Label>MB (LOG)</td>
    </tr>
    <tr>
        <td bgcolor="#EBE7E7" style="width: 150px">Last Backup FULL:</td>
        <td>
            <table cellpadding="0" cellspacing="0" style="width: 100%">
                <tr>
                    <td style="width: 30%"><asp:Label ID="lblLastBackupFULL" runat="server"></asp:Label></td>
                    <td style="width: 70%; text-align: right;">FULL backup required within:<asp:TextBox ID="txtBackupFrequencyFULL" runat="server" Width="75px"></asp:TextBox>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtBackupFrequencyFULL" Display="Dynamic" ErrorMessage="Integer" Font-Bold="True" Font-Size="Smaller" ValidationExpression="^[0-9]+$"></asp:RegularExpressionValidator>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtBackupFrequencyFULL" Display="Dynamic" ErrorMessage="RequiredFieldValidator" Font-Bold="True" Font-Size="Smaller">Required</asp:RequiredFieldValidator>
                        hours.</td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td bgcolor="#EBE7E7" style="width: 150px">Last Backup DIFF:</td>
        <td>
            <table cellpadding="0" cellspacing="0" style="width: 100%">
                <tr>
                    <td style="width: 30%"><asp:Label ID="lblLastBackupDIFF" runat="server"></asp:Label></td>
                    <td style="width: 70%; text-align: right;">DIFF backup required within:<asp:TextBox ID="txtBackupFrequencyDIFF" runat="server" Width="75px"></asp:TextBox>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="txtBackupFrequencyDIFF" Display="Dynamic" ErrorMessage="Integer" Font-Bold="True" Font-Size="Smaller" ValidationExpression="^[0-9]+$"></asp:RegularExpressionValidator>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtBackupFrequencyDIFF" Display="Dynamic" ErrorMessage="RequiredFieldValidator" Font-Bold="True" Font-Size="Smaller">Required</asp:RequiredFieldValidator>
                        hours.</td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td bgcolor="#EBE7E7" style="width: 150px">Last Backup LOG:</td>
        <td>
            <table cellpadding="0" cellspacing="0" style="width: 100%">
                <tr>
                    <td style="width: 30%"><asp:Label ID="lblLastBackupLOG" runat="server"></asp:Label></td>
                    <td style="width: 70%; text-align: right;">LOG backup required within:<asp:TextBox ID="txtBackupFrequencyLOG" runat="server" Width="75px"></asp:TextBox>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ControlToValidate="txtBackupFrequencyLOG" Display="Dynamic" ErrorMessage="Integer" Font-Bold="True" Font-Size="Smaller" ValidationExpression="^[0-9]+$"></asp:RegularExpressionValidator>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtBackupFrequencyLOG" Display="Dynamic" ErrorMessage="RequiredFieldValidator" Font-Bold="True" Font-Size="Smaller">Required</asp:RequiredFieldValidator>
                        hours.</td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td bgcolor="#EBE7E7" style="width: 150px">Recovery Model:</td>
        <td><asp:Label ID="lblRecoveryModel" runat="server"></asp:Label></td>
    </tr>
    <tr>
        <td bgcolor="#EBE7E7" style="width: 150px;">Compatibility Level:</td>
        <td><asp:Label ID="lblCompatibilityLevel" runat="server"></asp:Label></td>
    </tr>
    </table>
<table id="tblDatabaseTrending" runat="server" cellpadding="5" cellspacing="0"  width="100%">
    <tr><td colspan=2>
    <asp:Chart ID="chtDay" runat="server" BorderlineColor=Black BorderlineDashStyle=Solid BackColor="#B6D6EC" BackGradientStyle=TopBottom BackSecondaryColor=White Height=200 Width=795 >
        <ChartAreas>
            <asp:ChartArea Name="MonthChartArea" BackGradientStyle=TopBottom BackSecondaryColor="#B6D6EC" BorderDashStyle=Solid BorderWidth=2 >
            <AxisX Interval="1" TextOrientation="Rotated90">
            </AxisX>
            </asp:ChartArea>
        </ChartAreas>
    </asp:Chart> </td></tr>
    <tr>
    <td align=left>
    <asp:Chart ID="chtMonth" runat="server" BorderlineColor=Black 
            BorderlineDashStyle=Solid BackColor="#B6D6EC" BackGradientStyle=TopBottom 
            BackSecondaryColor=White Height=200 Width=500>   
        <ChartAreas>
            <asp:ChartArea Name="MonthChartArea" BackGradientStyle=TopBottom BackSecondaryColor="#B6D6EC" BorderDashStyle=Solid BorderWidth=2>
            <AxisX Interval="1" TextOrientation="Rotated90">
            </AxisX>
            </asp:ChartArea>
        </ChartAreas>
    </asp:Chart> 
    </td>
    <td align=right>
    <asp:Chart ID="chtYear" runat="server" BorderlineColor=Black BorderlineDashStyle=Solid BackColor="#B6D6EC" BackGradientStyle=TopBottom BackSecondaryColor=White Height=200 Width=290>
        <ChartAreas>
            <asp:ChartArea Name="YearChartArea" BackGradientStyle=TopBottom BackSecondaryColor="#B6D6EC" BorderDashStyle=Solid BorderWidth=2>
            <AxisX Interval="1" TextOrientation="Rotated90">
            </AxisX>
            </asp:ChartArea>
        </ChartAreas>
    </asp:Chart>
    </td>
    </tr>
</table>
<table id="tblNotes" runat=server cellpadding="5" cellspacing="0" width="100%">
<tr><td bgcolor="#EBE7E7">
<table style="width: 100%">
<tr><td>Notes</td><td align=right><asp:LinkButton ID="btnAddNote" runat="server" OnClick="btnAddNote_Click">Add Note</asp:LinkButton></td></tr>
</table>
</td></tr>
</table>
<table width="100%" cellpadding=0 cellspacing=0>
<tr><td width=100%>
    <asp:SqlDataSource ID="DS" runat="server" ConnectionString="<%$ ConnectionStrings:Application_Data %>" 
                                       SelectCommand="SELECT DatabaseNoteID,InstanceName, DatabaseName,Note,CreatedBy,convert(char(10),CreateDate,101) as CreateDate FROM DatabaseNote Where InstanceName=@InstanceName AND DatabaseName=@DatabaseName"
                                       DeleteCommand="DELETE FROM DatabaseNote Where DatabaseNoteID = @DatabaseNoteID">     
                        <SelectParameters>
                            <asp:QueryStringParameter Name="InstanceName" QueryStringField="InstanceName" Type="Object"/>
                            <asp:QueryStringParameter Name="DatabaseName" QueryStringField="DatabaseName" Type="Object"/>
                        </SelectParameters>   
                        <DeleteParameters>
                            <asp:Parameter Name="DatabaseNoteID" Type="Int32" />
                        </DeleteParameters>               
                    </asp:SqlDataSource>
    <asp:GridView ID="gv" DataKeyNames="DatabaseNoteID" runat="server" AllowSorting="False" 
        AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" 
        GridLines="None" Width="100%" DataSourceID="DS">
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <Columns>
            <asp:HyperLinkField DataNavigateUrlFields="instancename" 
                DataNavigateUrlFormatString="~/InstanceDetail.aspx?InstanceName={0}" 
                DataTextField="instancename" HeaderText="Instance" 
                NavigateUrl="~/InstanceDetail.aspx">
            <ItemStyle HorizontalAlign="Left" />
            <HeaderStyle HorizontalAlign="Left" />
            </asp:HyperLinkField>
            <asp:HyperLinkField DataNavigateUrlFields="instancename,databasename" 
                DataNavigateUrlFormatString="~/DatabaseDetail.aspx?InstanceName={0}&amp;DatabaseName={1}" 
                DataTextField="databasename" HeaderText="databasename">
            <ItemStyle HorizontalAlign="Left" />
            <HeaderStyle HorizontalAlign="Left" />
            </asp:HyperLinkField>
            <asp:BoundField DataField="Note" HeaderText="Note">
            <ItemStyle HorizontalAlign="Left" />
            <HeaderStyle HorizontalAlign="Left" />
            </asp:BoundField>
            <asp:BoundField DataField="CreatedBy" HeaderText="CreatedBy">
            <ItemStyle HorizontalAlign="Left" />
            <HeaderStyle HorizontalAlign="Left" />
            </asp:BoundField>
            <asp:BoundField DataField="CreateDate" HeaderText="Date">
            <ItemStyle HorizontalAlign="Left" />
            <HeaderStyle HorizontalAlign="Left" />
            </asp:BoundField>
            <asp:CommandField DeleteText="Delete" ShowDeleteButton="True">
            <ItemStyle HorizontalAlign="Right" Width=10% />
            </asp:CommandField>
        </Columns>
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
        <EditRowStyle BackColor="#999999" />
        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
        <HeaderStyle BackColor="#003366" Font-Bold="True" Font-Size="X-Small" 
            ForeColor="White" />
        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
    </asp:GridView>
</td>
</tr>
</table>
</asp:Content>